<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/

include_once('Admin.php');
include_once('../config/userauthority.php');
$TemUrl = "../templates/{$Webtemplates[0]}/"; //以第一种语言模板文件为默认
if(!is_dir($TemUrl)) MsgBox(1,"目录不存在:{$TemUrl}",'-1');

if($_POST['Action'] == 'Sub'){
	$UserPage = '<?php' . "\n";
	$UserPage .= '// 以下模板页只有会员才可以访问' . "\n";
	if(empty($_POST['UserPage'])){
		$UserPage .= '$UserFile = array();' . "\n";
	} else {
		$UserPage .= '$UserFile = array(' . "\n";
		$UserPage .= "	'" . implode("',\n	'",$_POST['UserPage']) . "' \n";
		$UserPage .= ');' . "\n";
	}
	$UserPage .= '?>';
	if(!file_put_contents('../config/userauthority.php',$UserPage)) MsgBox(1,"没有写入 ../config/userauthority.php 文件的权限！","1");
	AdminLog(1,1,'修改前台会员权限，结果：操作成功！');
	MsgBox (1,'会员权限修改成功！','1');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./images/adminstyle.css" rel="stylesheet" type="text/css" />
<link rel="Shortcut Icon" href="../favicon.ico">
<link rel="Bookmark" href="../favicon.ico">
<script src="../js/csshovernotie6.js" type="text/javascript"></script>
</head>
<body>
<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr class="Notodd">
	<td>&nbsp;</td>
	<td align="right">
		<input type="button" value="添加会员" onClick="javascript:location.href='UsersAdd.php?Lang=<?php echo $Lang?>'">
		<input type="button" value="会员管理" onClick="javascript:location.href='UsersManage.php?Lang=<?php echo $Lang?>'">		
	</td>
	</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
<form id="form1" name="form1" method="post" action="">
  <tr>
  	<td align="center" class="Main_Title">会员权限管理</td>
  	</tr>
  <tr class="Notodd">
  <td style="background:#FFF;" align="center">

	<table width="98%" cellpadding="4" cellspacing="1">
	<tr><td colspan="3" style="background:#FFF;" align="left"><strong>请选择只有会员(必须登录)才可以访问的模板页，以主模板文件名为准：</strong></td></tr>
	<tr> 
	<?php
	$in = 0;
	$FileArr = MyScandir($TemUrl);
	foreach ($FileArr as $i => $n){
		if(('.'.Extend($n)) == $TemplateSuffix && $n != 'top'.$TemplateSuffix && $n != 'bottom'.$TemplateSuffix && !stristr($n,'component_')){
			$in++;
			echo '<td height="22" style="background:#FFF;" align="left">' . "\n";
			if(in_array($n,$UserFile)){
				echo "<input name=\"UserPage[]\" type=\"checkbox\" value=\"{$n}\" checked /> \n";
			} else {
				echo "<input name=\"UserPage[]\" type=\"checkbox\" value=\"{$n}\" /> \n";
			}
			echo $n;
			echo '</td>' . "\n";
			if ($in % 3 == 0) echo '</tr><tr class="odd">';
		}
	}
	?>
	</tr>
	<tr><td colspan="3" style="background:#FFF;" align="left" height="40">
	<input type="hidden" name="Action" value="Sub" />
	<input type="submit" name="button" id="button" value=" 确 定 " class="submit" /><br />
</td></tr>
	</table>
	
</td>	
  	</tr>
  </form>
  </table>
  
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="6">
	<tr class="Notodd">
		<td style="color:#333333; line-height:20px;">
注：1、如果开通了HTML静态功能，生成后的静态页面将不受权限控制。<br />
		</td>
	</tr>
</table>  
</body>
</html> 
